-
Notifications
You must be signed in to change notification settings - Fork 158
model predict: move getModel from rest to transport #3687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Jing Zhang <jngz@amazon.com>
}; | ||
MLPredictionTaskRequest predictionRequest = getRequest( | ||
modelId, | ||
Objects.requireNonNullElse(userAlgorithm, functionName.get().name()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible both userAlgorithm
and functionName
are null?
}); | ||
try (ThreadContext.StoredContext context = client.threadPool().getThreadContext().stashContext()) { | ||
modelManager | ||
.getModel( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After refactoring, this method will not be invoked, is that correct ?
Got a test failure as below, looking into it.
|
} else if (FunctionName.isDLModel(FunctionName.from(modelType.toUpperCase(Locale.ROOT))) | ||
&& !mlFeatureEnabledSetting.isLocalModelEnabled()) { | ||
throw new IllegalStateException(LOCAL_MODEL_DISABLED_ERR_MSG); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: redundant else if, can be a separate if block
if (FunctionName.REMOTE.name().equals(modelType) && !mlFeatureEnabledSetting.isRemoteInferenceEnabled()) { | ||
throw new IllegalStateException(REMOTE_INFERENCE_DISABLED_ERR_MSG); | ||
} else if (FunctionName.isDLModel(FunctionName.from(modelType.toUpperCase(Locale.ROOT))) | ||
&& !mlFeatureEnabledSetting.isLocalModelEnabled()) { | ||
throw new IllegalStateException(LOCAL_MODEL_DISABLED_ERR_MSG); | ||
} else if (ActionType.BATCH_PREDICT == actionType && !mlFeatureEnabledSetting.isOfflineBatchInferenceEnabled()) { | ||
if (ActionType.BATCH_PREDICT == actionType && !mlFeatureEnabledSetting.isOfflineBatchInferenceEnabled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Description
To prevent security issue, put index read behind transport call.
Related Issues
#3651
Check List
--signoff
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.